from django.shortcuts import render, redirect, reverse  # 页面重定向
from django.template.loader import get_template

# Create your views here.

from django.http import HttpResponse
app_name = 'student'


def index(request):  # 页面重定向
    # 下面三行可以简化为下一行
    # tp = get_template('teacher/index.html')
    # html = tp.render()
    # return HttpResponse(html)
    return render(request, 'teacher/index.html')
    # return redirect('http://www.baidu.com')


# def login(request):  # 页面重定向
#     # return HttpResponse('登录页面')
#     return redirect('/teacher/index')   # 跳转index页面


def login(request):  # url重命名
    url = reverse('teacher:index')
    return redirect(url)


def detail(request, pk, status):  # primary key
    return HttpResponse('这是学生id为%s的详情页' % pk)


def students(request, year, month):
    return HttpResponse('%s年%s月报名的学生列表' % (year, month))
